function [outdat] = rt_rawdat_query(siteID,t_interval)

try
    sqlQuery = {'SELECT RawValueID, SiteID, PostedUTCDatetime, PressureQuantity, TemperatureQuantity, SalinityQuantity, Aux0Quantity, Aux1Quantity, Aux2Quantity, Aux3Quantity',...
                'FROM RawValue',...
                ['WHERE (((SiteID)=''' siteID ''') AND ((PostedUTCDatetime)>=''' datestr(t_interval(1),23) ''' And (PostedUTCDatetime)<=''' datestr(t_interval(2),23) '''))'],...
                'ORDER BY PostedUTCDatetime;'};
               
    conn   = database('Mooring_COTS_Dev', '', '');
    dbmeta = get(dmd(conn));
    disp(['User: ' dbmeta.UserName])
    curs   = exec(conn, [sqlQuery{1} ' ' sqlQuery{2} ' ' sqlQuery{3} ' ' sqlQuery{4}]);
    setdbprefs('DataReturnFormat','cellarray')
    curs = fetch(curs);
    close(conn)
    outdat = curs.Data;
    h = msgbox('Data Extracted...','Success');
catch ME
    h = errordlg('Error Extracting Data...','Error');
end

conn   = database('Mooring_COTS_Dev', '', '');
dbmeta = dmd(conn);